home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_02_08
/
2n08056a
< prev
next >
Wrap
Text File
|
1991-06-09
|
384b
|
22 lines
/*
Random number generator used by the standard
library for the Microsoft C compiler version 5.1.
*/
static unsigned long seed;
void srand(int iseed)
{
seed = (unsigned long) iseed << 16;
}
int rand()
{
/*
** incidental mod of 2^32 by ignoring
** overflow during multiply and add
*/
seed = seed * 214013L + 2531011L;
return ((seed >> 16) & 0x7FFF);
}